export interface ClickBoardEvent {
  offsetX: number,
  offsetY: number
}

export enum ChessType {
  // 黑子
  BLACK = 'H',
  // 白子
  WHITE = 'B',
  // 空子
  NULL = 'O'
}

export interface Chess {
  x: number,
  y: number,
  type: ChessType
}

export enum ErrorCode {
  // 成功
  SUCCESS = '0',
  // 有子
  HAS = '1',
  // 自杀
  SUICIDE = '2',
  // 打劫
  DAJIE = '3',
  // 越界
  OUT = '4'
}

export interface ErrorMsg {
  code: ErrorCode,
  msg: string
}

export interface WeiQiMusic {
  go(): void,
  eat(): void,
  release(): void
}

export interface WeiQi {
  getStepCount(): number
  boardSize: number,
  chessType: ChessType,
  onBeforePut: (chess: Chess) => boolean
  onError: (err: ErrorMsg) => void
  onAfterPut: (chess: Chess) => void
  backStep(): void
  changeRoadNum(n: number): void
  reset(): void
  clickBoard(event: ClickBoardEvent): void
  getChessBoard(): ChessType[][]
  getSteps(): Chess[]
  initSize(): void
  readStep(x: number, y: number, type: ChessType, errCallBack?: (err: ErrorMsg) => void): void
  useMusic(music: WeiQiMusic): void
}